import pandas as pd

pd.set_option('display.unicode.east_asian_width', True)
df = pd.DataFrame({'职业':['教师','司机','编辑'],'城市':['北京','青岛','武汉']})
print('原始数据:\n', df)
print('原始数据:\n',pd.get_dummies(df))
print('原始数据:\n',pd.get_dummies(df,prefix='居住地',prefix_sep='-',columns=['城市']))